package br.com.primeira.util;

public class Vector2
{
	int x;
	int y;
	
	public Vector2(int x, int y)
	{
		this.x = x;
		this.y = y;
	}
	
	public int getX()
	{
		return x;
	}
	
	public int getY()
	{
		return y;
	}
	
	public void addToSelf(Vector2 vector)
	{
		x += vector.getX();
		y += vector.getY();
	}
	
	public void subtractToSelf(Vector2 vector)
	{
		x -= vector.getX();
		y -= vector.getY();
	}
	
	public Vector2 add(Vector2 vector)
	{
		return new Vector2(x + vector.getX(), y + vector.getY());
	}
	
	public Vector2 subtract(Vector2 vector)
	{
		return new Vector2(x - vector.getX(), y - vector.getY());
	}
	
	@Override
	public String toString()
	{
		return "<" + x + ", " + y + ">";
	}
}
